﻿using IMark.DAO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IMark.Admin.Product
{
    public partial class Delete : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Utils.CheckAuthentication())
            {
                string ID = Request.QueryString["ID"] ?? String.Empty;
                if (ID == String.Empty)
                {
                    Response.Redirect("~/Admin/Product/Index.aspx");
                }
                else
                {
                    //xoa file cu                    
                    bool status = SanPhamModels.Delete(long.Parse(ID));
                    if (status)
                    {
                        Session["Info"] = "<div class='alert alert-success'>Xóa sản phẩm thành công !!!</div>";
                    }
                    else
                    {
                        Session["Info"] = "<div class='alert alert-danger'>Đã xảy ra lỗi, vui lòng thử lại !!!</div>";
                    }
                    Response.Redirect("~/Admin/Product/Index.aspx");
                }
            }
        }
    }
}